<template>
    <div class="app-container">
        <div class="block">
            <el-row  :gutter="20">
                <el-col :span="4">
                    <el-input v-model="listQuery.id" size="mini" placeholder="请输入订单ID"></el-input>
                </el-col>
                <el-col :span="4">
                  <el-select v-model="listQuery.state" size="mini" placeholder="请选择处理类型">
                    <el-option value="5" label="未处理"></el-option>
                    <el-option value="0" label="已处理"></el-option>
                  </el-select>
                </el-col>
                <el-col :span="6">
                    <el-button type="success" size="mini" icon="el-icon-search" @click.native="search">{{ $t('button.search') }}</el-button>
                    <el-button type="primary" size="mini" icon="el-icon-refresh" @click.native="reset">{{ $t('button.reset') }}</el-button>
                </el-col>
            </el-row>
            <br>
            <el-row>
                <el-col :span="24">
                </el-col>
            </el-row>
        </div>


        <el-table :data="list" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row
                  @current-change="handleCurrentChange">
          <el-table-column label="订单ID">
            <template slot-scope="scope">
              {{scope.row.id}}
            </template>
          </el-table-column>
            <el-table-column label="任务ID">
                <template slot-scope="scope">
                    {{scope.row.taskId}}
                </template>
            </el-table-column>
            <el-table-column label="接单人ID">
                <template slot-scope="scope">
                    {{scope.row.createBy}}
                </template>
            </el-table-column>
            <el-table-column label="发布人ID">
                <template slot-scope="scope">
                    {{scope.row.issuerId}}
                </template>
            </el-table-column>
            <el-table-column label="订单状态">
                <template slot-scope="scope">
                    <span v-if="scope.row.state == 1">待提交</span>
                    <span v-else-if="scope.row.state == 2">审核中</span>
                    <span v-else-if="scope.row.state == 3">已完成</span>
                    <span v-else-if="scope.row.state == 4">未通过</span>
                    <span v-else-if="scope.row.state == 5">已申诉</span>
                    <span v-else>已取消</span>
                </template>
            </el-table-column>
            <el-table-column label="任务标题">
                <template slot-scope="scope">
                    {{scope.row.taskTitle}}
                </template>
            </el-table-column>
            <el-table-column label="提交凭证时间">
                <template slot-scope="scope">
                    {{scope.row.submitTime}}
                </template>
            </el-table-column>
            <el-table-column label="不通过原因">
                <template slot-scope="scope">
                    {{scope.row.reason}}
                </template>
            </el-table-column>
            <el-table-column label="申诉内容">
                <template slot-scope="scope">
                    {{scope.row.appeal}}
                </template>
            </el-table-column>
            <el-table-column label="平台处理内容">
                <template slot-scope="scope">
                    {{scope.row.failureRecovery}}
                </template>
            </el-table-column>
            <el-table-column label="平台处理人编号">
                <template slot-scope="scope">
                    {{scope.row.sysUserId}}
                </template>
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button type="text" size="mini" icon="el-icon-view" @click.native="handle(1,scope.row)">查看</el-button>
                    <el-button v-if="scope.row.state == 5" type="text" size="mini" icon="el-icon-s-check" @click.native="handle(2,scope.row)">处理申述</el-button>
                </template>
            </el-table-column>
        </el-table>

        <el-pagination
                background
                layout="total, sizes, prev, pager, next, jumper"
                :page-sizes="[10, 20, 50, 100,500]"
                :page-size="listQuery.limit"
                :total="total"
                @size-change="changeSize"
                @current-change="fetchPage"
                @prev-click="fetchPrev"
                @next-click="fetchNext">
        </el-pagination>

        <el-dialog
                :title="formTitle"
                :visible.sync="formVisible"
                width="70%">
              <el-dialog
                width="30%"
                title="申述处理"
                :visible.sync="innerVisible"
                append-to-body>
                <el-form ref="form" label-width="20%">
                  <el-form-item label="处理回复内容">
                    <el-input v-model="failureRecovery"></el-input>
                  </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
                          <el-button  @click="innerVisible = false">取 消</el-button>
                          <el-button  type="primary" @click="submitAppeal(selRow.id)">确 认</el-button>
                        </span>
              </el-dialog>
          <el-row>
            <el-col :span="4">
              <div class="hint">提交凭证时间</div>
            </el-col>
            <el-col :span="20">
              <div class="color-black">{{selRow.submitTime}}</div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <div class="hint">不通过原因</div>
            </el-col>
            <el-col :span="20">
              <div class="color-black">{{selRow.reason}}</div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <div class="hint">申诉内容</div>
            </el-col>
            <el-col :span="20">
              <div class="color-black">{{selRow.appeal}}</div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <div class="hint">平台处理内容</div>
            </el-col>
            <el-col :span="20">
              <div class="color-black">{{selRow.failureRecovery}}</div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <div class="hint">收集的凭证</div>
            </el-col>
          </el-row>
          <el-row v-for="proof in taskPoofs" style="padding-left: 50px">
            <el-col :span="12">
              <div class="hint-proof color-black">{{proof.name}}</div>
            </el-col>
            <el-col :span="12" style="margin-bottom: 20px">
              <div class="block" v-if="proof.type == 2">
                <el-image :src="'/dev-api/file/getImgStream?idFile='+proof.content"></el-image>
              </div>
              <div v-else class="color-rosybrown">{{proof.content}}</div>
            </el-col>
          </el-row>
          <span slot="footer" class="dialog-footer">
            <el-button @click="formVisible = false">取 消</el-button>
            <el-button v-if="selRow.state == 5" type="primary" @click="handleAppeal(1)">申述成功</el-button>
            <el-button v-if="selRow.state == 5" type="info" @click="handleAppeal(2)">申述失败</el-button>
          </span>
        </el-dialog>
    </div>
</template>

<script src="./taskOrder.js"></script>
<style type="text/css">
  .hint{
    height: 30px;
    height: 30px;
    text-align: right;
    padding-right: 10px;
  }
  .hint-proof{
    width: 50%;
    height: 30px;
    text-align: right;
    padding-right: 10px;
  }
  .color-black{
    color: black;
    font-weight: bold;
  }
  .color-rosybrown{
    color: rosybrown;
    font-weight: bold;
  }
</style>

<style rel="stylesheet/scss" lang="scss" scoped>
    @import "src/styles/common.scss";
</style>

